package creadorNiveles;

import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JLabel;
import java.awt.Color;
import java.awt.Dimension;

import javax.swing.JButton;
import javax.swing.border.BevelBorder;
import javax.swing.border.CompoundBorder;
import javax.swing.border.LineBorder;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.SwingConstants;

import org.core.Nivel;
import org.core.Nivel.TipoNivel;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class Escenas extends JPanel {
	
	private JLabel lblN;
	private JLabel lblTitulo;
	private Nivel nivel;
	private ConectorNiveles padre;

	/**
	 * Create the panel.
	 */
	public Escenas(ConectorNiveles padre) {
		this.padre=padre;
		addMouseListener(new MouseAdapter() {
			@Override
			public void mousePressed(MouseEvent arg0) {
				setSelected();
			}
		});
		
		setPreferredSize(new Dimension(160,80));
		
		setBorder(new LineBorder(Color.RED));
		setBackground(Color.DARK_GRAY);
		setLayout(null);
		
		
		lblTitulo = new JLabel("Nivel nuevo");
		lblTitulo.setForeground(Color.WHITE);
		lblTitulo.setBounds(10, 36, 150, 14);
		add(lblTitulo);
		
		lblN = new JLabel("N");
		lblN.setHorizontalAlignment(SwingConstants.CENTER);
		lblN.setForeground(Color.WHITE);
		lblN.setBounds(131, 11, 20, 14);
		add(lblN);

	}

	protected void setSelected() {
		// TODO Auto-generated method stub
		padre.setSelected(this);
		
	}

	protected void eliminar(int i) {
		// TODO Auto-generated method stub
	}
	
	public void setNombre(String nombre){
		nivel.setNombre(nombre);
		lblTitulo.setText(nombre);
	}
	
	public void setNumero(int n){
		lblN.setText(n+"");
		nivel.setNumero(n);
	}
	
	public void setNivel(Nivel nivel){
		this.nivel=nivel;
		if(nivel.getTipo()==TipoNivel.Inicio){
			setBackground(Color.BLUE);
		}
		lblN.setText(""+nivel.getNumero());
	}
	
	public Nivel getNivel(){
		return nivel;
	}
}
